<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>
<script type="text/javascript" src="<?php echo JS_PATH?>jquery.sgallery.js"></script>
<div class="pad-lr-10">
<?php 
    $status_array = array(
        1=>"待支付",
        2=>"支付失败",
        3=>"已支付"
    );
?>
<form name="searchform" action="?m=order&c=manage&a=init" method="get">
		<input type="hidden" value=order name="m"> 
		<input type="hidden" value="manage" name="c"> 
		<input type="hidden" value="init" name="a">
		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
				<tr>
					<td>
						<div class="explain-col">
							<?php echo L('order_num')?>:<input name="order_num" class="input-text" value="<?php echo $_GET['order_num']?>" type="text" size="25">
							<?php echo L('user_name')?>:<input name="user_name" class="input-text" value="<?php echo $_GET['user_name']?>" type="text" size="20"> 
							<?php echo L('status')?>:<select name="status">
								<option value="" selected="">请选择状态</option>
								<?php foreach($status_array as $k=>$v){?>
								<option value="<?php echo $k;?>" <?php if($k==$status){echo 'selected';}?>><?php echo $v;?></option>
								<?php }?>
								</select>
							&nbsp;&nbsp;&nbsp;<input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit">
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</form>
<form name="myform" action="?m=order&c=manage&a=del" method="post" onsubmit="return confirm('<?php echo L('confirm')?>')">
<div class="table-list">
<table width="100%" cellspacing="0">
	<thead>
		<tr>
			<th  align="center" width="20"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th>
			<th align="center">ID</th>
			<th align="center"><?php echo L('order_num')?></th>
			<th align="center"><?php echo L('user_name')?></th>
			<th align="center"><?php echo L('order_type')?></th>
			<th align="center"><?php echo L('total_price').'(单位:元)'?></th>
			<th align="center"><?php echo L('status')?></th>
			<th align="center"><?php echo L('create_time')?></th>
			<th align="center"><?php echo L('operation')?></th>
		</tr>
	</thead>
<tbody>
<?php
if(!empty($order_info)){
	foreach($order_info as $k=>$v) {
?>
    <tr>
		<td align="center"><input type="checkbox" value="<?php echo $v['id']?>" name="id[]"></td>
		<td align="center"><?php echo $v['id']?></td>
		<td align="center"><?php echo $v['order_num']?$v['order_num']:'<font color="red">（未设置）</font>';?></td>
		<td align="center"><?php echo $v['user_name']?$v['user_name']:'<font color="red">（未设置）</font>';?></td>
		<td align="center"><?php if(!empty($v['order_type'])){if($v['order_type']==1){echo '投票';}elseif($v['order_type']==2){echo '商品';}else{echo '其他';}}else{echo '<font color="red">（未设置）</font>';}?></td>
		<td align="center"><?php echo $v['total_price']?'￥'.$v['total_price']:'<font color="red">（未设置）</font>';?></td>
		<td align="center"><?php if(!empty($v['status'])){if($v['status']==1){echo '<font color="#FF6600"><b>待支付</b></font>';}elseif($v['status']==2){echo '<font color="red"><b>支付失败</b></font>';}elseif($v['status']==3){echo '<font color="green"><b>已支付</b></font>';}else{echo '请联系管理员';}}else{echo '<font color="red">（未设置）</font>';}?></td>
		<td align="center"><?php if(!empty($v['create_time'])){echo $v['create_time'];}else{echo '<font color="red">（未设置）</font>';}?></td>
		<td align="center">
		<a href="?m=order&c=manage&a=detail&id=<?php echo $v['id']?>"><?php echo L('detail');?></a>
		&nbsp;|&nbsp;
		<a href="?m=order&c=manage&a=del&id=<?php echo $v['id']?>&name=<?php echo $v['user_name'];?>&order_num=<?php echo $v['order_num'];?>" onClick="return confirm('<?php echo L('confirm')?>')"><?php echo L('del')?></a>
		</td>
    </tr>
<?php
	}
} else {
?>
	<tr><td colspan='11' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>
<?php }?>
</tbody>
</table>

<div class="btn">
<label for="check_box"><a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('select_all')?></a>/<a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a></label> <input type="submit" class="button" name="dosubmit" value="<?php echo L('delete')?>"/>
</div>

<div id="pages"><?php echo $pages?></div>
</div>
</form>
</div>
</body>
</html>